package idiet.service;

import java.util.List;

import idiet.bean.Nation;
import idiet.dao.hibernate.NationDao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository("nationService")
public class NationService {
	@Autowired
	NationDao nationDao;
	public Nation getNationById(int nationId){
		return this.nationDao.getNationById(nationId);
	}
	public List<Nation> getNationsByNationName(String nationName){
		if(nationName==null){
			return this.nationDao.getNations();
		}else{
			return this.nationDao.getNationsByNationName(nationName);
		}
	}
	public void createNation(Nation nation){
		this.nationDao.createNation(nation);
	}
	public void updateNation(Nation nation){
		this.nationDao.updateNation(nation);
	}
	public void deleteNation(Nation nation){
		this.nationDao.deleteNation(nation);
	}
}
